package com.iccct.customer.controller;

import com.iccct.customer.remote.IProviderService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * comment
 *
 * @author iccct (taowutt1@gmail.com)
 * @since 2021-07-28  14:07
 */
@RestController
@RequestMapping("/customer")
public class CustomerController {
    @Value("${spring.application.name}")
    private String name;

    @Resource
    private RestTemplate restTemplate;

    @Resource
    private IProviderService providerService;


    @GetMapping("/test")
    public String test(){
        //String forObject = restTemplate.getForObject("http://PROVIDER/provider/echo/" + name, String.class);
        String echo = providerService.echo(name);

        return echo;
    }
}
